<?php

/*

  Action	$3

  +1 Buy; +$1 per token on the Trade Route mat.
  Trash a card from your hand.
  Setup: Put a token on each Victory card Supply pile. When a card is gained from that pile, move the token to the Trade Route mat.


 */

class TradeRoute extends Card implements iAction, iKingdom, iProsperity {

    public function __construct() {
        parent::__construct("Trade Route", 3);
        $this->undoPlay = false;
        $this->undoBuy = true;
    }

    public function getDescription() {
        return array(
            "+1 Buy",
            "+$1 per token on the Trade Route mat",
            "Trash a card from your hand.",
            "Setup: Put a token on each Victory card Supply pile. When a card is gained from that pile, move the token to the Trade Route mat.");
    }
    
    public function play(Game $game, $isRealCard) {

        $game->addBuys(1);
        $cards = $game->getPlayHand();
        
		
        if (sizeof($cards) > 0) {
			$cards = getUniqueCards($cards);
			if (sizeof($cards) > 1) {
				$output = MySocket::GetUserReply($game, Input_ChooseOne, $cards, 1, 1, null, "Choose card to trash");
				$card_name = $output[0];
			}
			else {
				$card_name = $cards[0];
			}
            $card = $game->moveCardFromPileToPile($card_name, PlayHand, Trash);
             ScreenDisplay::addScreenMessage($game, true, "trash " . nicePrint($card), "trashes " . ScreenDisplay::$LMSG);
        }

        $cards = $game->getTradeRouteCards();
        $money = sizeof($cards);
        $game->addMoney(new Price($money));
         ScreenDisplay::addScreenMessage($game, false , " and get +$money$", " and gets +$money$");


        $game->cardActionFinished();
        return true;
    }

}

?>